﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DusonFramework.QueryHelper.SQL
{
    /// <summary>
    /// 查询条件实体类
    /// </summary>
    public class SearchInfo
    {
        #region 构造函数

        public SearchInfo() { }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="fieldName">字段名称</param>
        /// <param name="fieldValue">字段的值</param>
        /// <param name="sqlOperator">字段的Sql操作符类型</param>
        public SearchInfo(string fieldName, object fieldValue, OperatorType operatorType)
            : this(fieldName, fieldValue, operatorType, "")
        { }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="fieldName">字段名称</param>
        /// <param name="fieldValue">字段的值</param>
        /// <param name="operatorType">字段的Sql操作符类型</param>
        /// <param name="excludeValue">如果字段为该值,则不作为查询条件</param>
        public SearchInfo(string fieldName, object fieldValue, OperatorType operatorType, object excludeValue)
        {
            this._fieldName = fieldName;
            this._fieldValue = fieldValue;
            this._operatorType = operatorType;
            this._excludeValue = excludeValue;
        }

        #endregion

        #region 字段

        private string _fieldName;          // 字段名称
        private object _fieldValue;         // 字段的值
        private OperatorType _operatorType; // 字段的Sql操作符类型
        private object _excludeValue;       // 如果字段为该值,则不作为查询条件

        #endregion

        #region 属性

        /// <summary>
        /// 字段名称
        /// </summary>
        public string FieldName
        {
            get { return _fieldName; }
            set { _fieldName = value; }
        }

        /// <summary>
        /// 字段的值
        /// </summary>
        public object FieldValue
        {
            get { return _fieldValue; }
            set { _fieldValue = value; }
        }

        /// <summary>
        /// 字段的Sql操作符类型
        /// </summary>
        public OperatorType OperatorType
        {
            get { return _operatorType; }
            set { _operatorType = value; }
        }

        /// <summary>
        /// 如果字段为该值,则不作为查询条件
        /// </summary>
        public object ExcludeValue
        {
            get { return _excludeValue; }
            set { _excludeValue = value; }
        }

        #endregion

    }
}
